//
//  MineFansViewController.m
//  快圈
//
//  Created by 宁宁 on 16/9/12.
//  Copyright © 2016年 ym. All rights reserved.
//

#import "MineFansViewController.h"

#import "MineFansTableViewCell.h"//cell

#define Title0 @[@"粉丝数", @"购买单数", @"今日单数"]
#define Title1 @[@"粉丝团数", @"团队粉丝数", @"粉丝团单数", @"今日粉丝团单数"]

@interface MineFansViewController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation MineFansViewController

 static NSString *const MineFansTableViewCellID = @"MineFansTableViewCell";


- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self setNav];
    
    [self registerTableView];
}

- (void)setNav{
    self.title = @"我的粉丝团";
    UIBarButtonItem *back = [[UIBarButtonItem  alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    self.navigationItem.leftBarButtonItem = back;
}

- (void)registerTableView{
    [self.tableView registerNib:[UINib nibWithNibName:@"MineFansTableViewCell" bundle:nil] forCellReuseIdentifier:MineFansTableViewCellID];
}

#pragma mark === TableViewDelegate ===
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 15;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 15)];
    view.backgroundColor = RGBACOLOR(36, 34, 47, 1);
    return view;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 3;
    }else{
        return 4;
    }
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 46;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MineFansTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MineFansTableViewCellID];
    if (indexPath.section == 0) {
        cell.title.text = Title0[indexPath.row];
//        cell.num.text = 
    }else{
        cell.title.text = Title1[indexPath.row];
//        cell.num.text = 
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)back{
    [self.navigationController popViewControllerAnimated:YES];
}

- (UITableView *)tableView{
    if (!_tableView) {
        _tableView= [[UITableView alloc]initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorColor = [UIColor clearColor];
        _tableView.backgroundColor = RGBACOLOR(36, 34, 47, 1);
        _tableView.showsVerticalScrollIndicator = NO;//去掉滑动竖条
        _tableView.scrollEnabled = NO;
        [self.view addSubview:_tableView];
    }
    return _tableView;
}

@end
